// 全局过滤
let moment = require('moment');


// 通用字典过滤
exports.dictionaryFilter = (value, list) => {
    let item = list.find((elem) => {
        return elem.zddm === value;
    });
    return item ? item.zdz : value;
};

//2018-03-24
exports.dateFilter = (str) => {
    return moment(str).format('YYYY-MM-DD')
};

//2018-03-24 18:20:35
exports.dateTimeFilter = (str) => {
    return moment(str).format('YYYY-MM-DD HH:mm:ss')
};

//YYYYMMDDHHmmss => YYYY-MM-DD HH:mm:ss
exports.dateTimeFilterForJz = (str) => {
    return moment(str,'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm:ss')
};